$(function () {
    //Demo
    layui.use('form', function(){
        var form = layui.form;
    });
    selectCodeType("sex");
    selectCodeType("education");
    selectCodeType("group");
    let id = localStorage.getItem("personnelId");
    selectMyMessage(id);
})
function selectMyMessage(id) {
    let data1 = {
        id:id,
    }
    let data = myAjax("/personnel/selectMessageId",data1,"post");
    data = data.personnelBean;
    $("#personnelNumber").val(data.personnelNumber);
    $("#personnelType").val(data.personnelType);
    if (data.personnelType!='student'){
        let html='';
        $("#nogroup").html(html);
    }else {
        $("#group").val(data.personnelGroup);
    }
    $("#username").val(data.name);
    $("#sex").val(data.sex);
    $("#age").val(data.age);
    $("#education").val(data.education);
    $("#graduateSchool").val(data.graduateSchool);
    $("#nativeplace").val(data.nativeplace);
    $("#location").val(data.location);
    $("#phone").val(data.phone);
    $("#urgentphone").val(data.urgentphone);
}
function updateMyMessage() {
    let group = {
        groupNumber:$("#group").val(),
    }
    console.log(group);
    let ddd = myAjax("/group/selectGroupCodeNumber",group,"post");
    console.log(ddd);
    let data1 ={
        group:ddd.list,
        personnelNumber:$("#personnelNumber").val(),
        personnelType:$("#personnelType").val(),
        personnelGroup:$("#group").val(),
        groupName:$("#personnelGroup").text(),
        name:$("#username").val(),
        sex:$("#sex").val(),
        age:$("#age").val(),
        education:$("#education").val(),
        graduateSchool:$("#graduateSchool").val(),
        nativeplace:$("#nativeplace").val(),
        location:$("#location").val(),
        phone:$("#phone").val(),
        urgentphone:$("#urgentphone").val()
    }
    console.log(data1);
    let data = myAjax("/personnel/updateMessageId",data1,"post");
    if (data.result==1){
        alert("更新成功");
    }
}